package com.foreknow.demo11;

/**
 * 方法的参数和返回值类型可以为父类行
 */
public class Tets {
    public void m1(Pet pet){
        pet.getHealth();
        System.out.println( pet.getHealth());
    }

    public Pet m2(){
        Dog d = new Dog();
        d.setHealth(50);
        return d;
    }

    public double m3(){
        return 1;
    }
    public static void main(String[] args) {
        Tets tets = new Tets();
        Penguin p = new Penguin();
        p.setHealth(10);
        tets.m1(p);
        Pet pet =tets.m2();
        System.out.println(pet.getHealth());

        int ddd = (int) tets.m3();
    }
}
